export function setItem (key, val) {
  if (typeof val === 'object') {
    val = JSON.stringify(val)
  }
  localStorage[key] = val
}

export function getItem (key) {
  try {
    return JSON.parse(localStorage[key] || 'null')
  } catch (error) {
    return localStorage[key]
  }
}
